import Vue from 'vue'
import Router from 'vue-router'
// @ 表示src的绝对路径
import Index from '@/components/index.vue'
import Menus from '@/components/index/menus'
import Outline from '@/components/index/outline'
import Users from '@/components/index/users'
import Classes from '@/components/index/classes'
import Items from '@/components/index/items'
import Register from '@/components/register'
import Login from '@/components/login'
import PapersList from '@/components/index/papersList'
import PapersAdd from '@/components/index/papersAdd'
import PapersEdit from '@/components/index/papersEdit.vue'
import Count from '@/components/index/count.vue'
import Publish from '@/components/publish.vue'
import AnswerDown from '@/components/answerDown.vue'
import AnswerInvalid from '@/components/answerInvalid.vue'
import Person from '@/components/index/person.vue'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect:'/index',
    },
    {
      path:'/index',
      name:'index',
      redirect:'/index/users',
      component:Index,
      children:[
        {
          // 用户管理
          path:'users',
          component:Users
        },
        {
          // 菜单管理
          path:'menus',
          component:Menus
        },
        {
          // 大纲管理
          path:'outlines',
          component:Outline
        },
        {
          path:'papers',
          component:PapersList
        },
        {
          // 问卷列表
          path:'papers/list',
          name:'papersList',
          component:PapersList
        },
        {
          // 问卷添加
          path:'papers/add',
          name:'papersAdd',
          component:PapersAdd
        },
        {
          // 问卷编辑
          path:'papers/edit/:id',
          name:'papersEdit',
          props:true,
          component:PapersEdit
        },
        {
          // 班级管理
          path:'classes',
          component:Classes
        },
        {
          // 选项管理
          path:'items',
          component:Items
        },
        {
          // 分析
          path:'count/:paper_id',
          name:'count',
          props:true,
          component:Count
        },
        {
          // 个人中心
          path:'person',
          name:'person',
          component:Person
        }
      ]
    },
    {
      // 用户注册
      path:'/users/register',
      name:'register',
      component:Register
    },
    {
      // 用户登录
      path:'/users/login',
      name:'login',
      component:Login
    },
    {
      //问卷成功提交 
      path:'/answer/down',
      name:'answerDown',
      component:AnswerDown
    },
    {
      //问卷成功提交 
      path:'/answer/invalid',
      name:'answerInvalid',
      component:AnswerInvalid
    },
    {
      // 发布问卷
      path:'/papers/publish/:paper_id',
      name:'publish',
      props:true,
      component:Publish
    }
  ]
})
